﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using FRL.DebtChased.Silverlight.Library.RichContentService;
using FRL.DebtChased.Silverlight.Library;
using FRL.DebtChased.ChildWindows;

namespace FRL.DebtChased.ChaseWorkspace
{

	/// <summary>
	/// Declaration of ActiveInstalmentPlanPanelCtrl class
	/// Display details of the currently active instalment and option for defaulting
	/// </summary>
	public partial class ActiveInstalmentPlanPanelCtrl : UserControl
	{

		/////////////////////////////////////////////////////////////
		// Attributes

		private AccountPlanTransport m_accountPlan = null;

		/////////////////////////////////////////////////////////////
		// Construction

		public ActiveInstalmentPlanPanelCtrl()
		{

			// Load xaml resources
			InitializeComponent();

		}

		/////////////////////////////////////////////////////////////
		// Event Handler

		private void butDefault_Click(object sender, RoutedEventArgs e)
		{

			// Show the cancellation window
			CancelInstalmentPlanWnd wnd = new CancelInstalmentPlanWnd(m_accountPlan);
			wnd.Show();

		}

		/////////////////////////////////////////////////////////////
		// Operations

		public void Set(AccountTransport account)
		{

			// Retain plan
			m_accountPlan = account.ActiveAccountPlan;

			// Set controls
			tbDescription.Text = m_accountPlan.Description;

			// Add payments to grid
			gridPayment.Set(m_accountPlan);

		}

		public void PostSupportDataLoad()
		{

			// Called after plug-in has loaded support data

		}

	}

}
